<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java 面向对象编程完全指南</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .content-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
        }
        
        .content-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        .section-title {
            position: relative;
            padding-left: 20px;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 80%;
            background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        .code-block {
            background: #2d3748;
            color: #e2e8f0;
            border-radius: 8px;
            padding: 1.5rem;
            overflow-x: auto;
            position: relative;
        }
        
        .code-block::before {
            content: 'Java';
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            font-size: 0.75rem;
            color: #718096;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        
        .feature-card {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 2rem;
            border-radius: 16px;
            transition: all 0.3s ease;
        }
        
        .feature-card:hover {
            transform: scale(1.05);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
        }
        
        .concept-badge {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 9999px;
            font-size: 0.875rem;
            font-weight: 500;
            margin: 0.25rem;
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        
        .highlight-text {
            background: linear-gradient(120deg, #f093fb 0%, #f5576c 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            font-weight: 700;
        }
        
        .floating-icon {
            animation: float 3s ease-in-out infinite;
        }
        
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
        }
        
        .table-custom {
            border-collapse: separate;
            border-spacing: 0;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        
        .table-custom th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 1rem;
            text-align: left;
            font-weight: 600;
        }
        
        .table-custom td {
            padding: 1rem;
            border-bottom: 1px solid #e2e8f0;
            background: white;
        }
        
        .table-custom tr:last-child td {
            border-bottom: none;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 text-center">
            <div class="floating-icon inline-block mb-6">
                <i class="fas fa-code text-6xl"></i>
            </div>
            <h1 class="text-5xl md:text-6xl font-bold mb-4">
                Java <span class="highlight-text">面向对象编程</span>
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">
                掌握现代软件开发的核心编程范式
            </p>
            <div class="flex flex-wrap justify-center gap-4">
                <span class="concept-badge"><i class="fas fa-box mr-2"></i>封装</span>
                <span class="concept-badge"><i class="fas fa-sitemap mr-2"></i>继承</span>
                <span class="concept-badge"><i class="fas fa-shapes mr-2"></i>多态</span>
                <span class="concept-badge"><i class="fas fa-puzzle-piece mr-2"></i>抽象</span>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16">
        <div class="container mx-auto px-6">
            <div class="content-card rounded-2xl shadow-xl p-8 md:p-12">
                <div class="max-w-4xl mx-auto">
                    <p class="text-lg leading-relaxed text-gray-700 mb-6 indent-8">
                        今天我们要进入 Java 学习中最核心的部分之一——<strong class="text-purple-600">面向对象编程</strong>（Object-Oriented Programming, OOP）。这是 Java 的灵魂所在，也是现代软件开发中最重要的编程范式之一。无论你是刚接触编程的新手，还是已经具备一定经验的开发者，掌握面向对象编程的思想和方法都将为你的编程之旅打下坚实的基础。
                    </p>
                    <div class="text-center my-8">
                        <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1735198473689-41cbb5c5-2b57-40da-a2b6-067ea57086f4.png" 
                             alt="面向对象编程" 
                             class="inline-block rounded-lg shadow-lg max-w-sm">
                    </div>
                    <p class="text-lg leading-relaxed text-gray-700 indent-8">
                        为什么我们需要面向对象？从现实生活中我们可以发现，世界是由一个个对象组成的，每个对象都有自己的属性和行为。例如，一个"学生"可以有姓名、年龄这些属性，也可以执行"学习"、"参加考试"等行为。面向对象编程正是借助这种思想，将现实问题抽象为程序中的类与对象，通过封装、继承和多态等特性，更直观、高效地建模复杂的业务逻辑。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- 面向对象的基本概念 -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6">
            <h2 class="section-title text-4xl font-bold mb-12 text-gray-800">面向对象的基本概念</h2>
            
            <div class="content-card rounded-2xl shadow-xl p-8 md:p-12 mb-8">
                <p class="text-lg leading-relaxed text-gray-700 mb-8 indent-8">
                    面向对象编程（Object-Oriented Programming, OOP）是一种以对象为核心，通过模拟现实世界事物的属性和行为来设计和开发软件的编程范式。
                </p>
                
                <div class="text-center mb-12">
                    <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1735198532847-27876dad-3fc7-4c0b-9ae0-12aac440e91f.png" 
                         alt="OOP概念图" 
                         class="inline-block rounded-lg shadow-lg max-w-full">
                </div>

                <!-- 概念卡片网格 -->
                <div class="grid md:grid-cols-2 gap-8">
                    <!-- 类与对象 -->
                    <div class="bg-gradient-to-br from-purple-50 to-pink-50 rounded-xl p-6">
                        <h3 class="text-2xl font-bold mb-4 text-purple-800">
                            <i class="fas fa-cube mr-2"></i>1. 类与对象
                        </h3>
                        <div class="space-y-4">
                            <div>
                                <h4 class="font-semibold text-lg text-purple-700 mb-2">类（Class）</h4>
                                <ul class="space-y-2 text-gray-700">
                                    <li><i class="fas fa-check-circle text-purple-500 mr-2"></i>类是对象的模板或蓝图，定义了一组具有相同属性和行为的对象。</li>
                                    <li><i class="fas fa-check-circle text-purple-500 mr-2"></i>类中包含属性（字段）和方法（行为）的定义。</li>
                                    <li><i class="fas fa-check-circle text-purple-500 mr-2"></i>例如，<code class="bg-purple-200 px-2 py-1 rounded">Student</code> 类可以包含属性 <code class="bg-purple-200 px-2 py-1 rounded">name</code> 和 <code class="bg-purple-200 px-2 py-1 rounded">age</code>。</li>
                                </ul>
                            </div>
                            <div>
                                <h4 class="font-semibold text-lg text-purple-700 mb-2">对象（Object）</h4>
                                <ul class="space-y-2 text-gray-700">
                                    <li><i class="fas fa-check-circle text-purple-500 mr-2"></i>对象是类的实例，是具体的、有实际值的实体。</li>
                                    <li><i class="fas fa-check-circle text-purple-500 mr-2"></i>每个对象有自己的状态（属性值）和行为（方法的调用）。</li>
                                </ul>
                            </div>
                        </div>
                    </div>

                    <!-- 属性与方法 -->
                    <div class="bg-gradient-to-br from-blue-50 to-cyan-50 rounded-xl p-6">
                        <h3 class="text-2xl font-bold mb-4 text-blue-800">
                            <i class="fas fa-cogs mr-2"></i>2. 属性与方法
                        </h3>
                        <div class="space-y-4">
                            <div>
                                <h4 class="font-semibold text-lg text-blue-700 mb-2">属性</h4>
                                <p class="text-gray-700 mb-2">描述对象的特征，类中以字段（Field）的形式定义。</p>
                                <div class="code-block text-sm">
                                    <code>private String name;</code>
                                </div>
                            </div>
                            <div>
                                <h4 class="font-semibold text-lg text-blue-700 mb-2">方法</h4>
                                <p class="text-gray-700 mb-2">定义对象的行为或功能，通过方法实现操作。</p>
                                <div class="code-block text-sm">
                                    <code>public void study() {<br>&nbsp;&nbsp;System.out.println(name + " is studying.");<br>}</code>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 核心特性展示 -->
                <div class="mt-12">
                    <h3 class="text-2xl font-bold mb-8 text-center text-gray-800">面向对象的四大核心特性</h3>
                    
                    <div class="mermaid">
                        graph TD
                            A[面向对象编程] --> B[封装 Encapsulation]
                            A --> C[继承 Inheritance]
                            A --> D[多态 Polymorphism]
                            A --> E[抽象 Abstraction]
                            
                            B --> B1[隐藏内部实现]
                            B --> B2[提供公共接口]
                            
                            C --> C1[代码复用]
                            C --> C2[建立层次结构]
                            
                            D --> D1[方法重载]
                            D --> D2[方法重写]
                            
                            E --> E1[抽象类]
                            E --> E2[接口]
                            
                            style A fill:#667eea,stroke:#764ba2,stroke-width:3px,color:#fff
                            style B fill:#f093fb,stroke:#f5576c,stroke-width:2px,color:#fff
                            style C fill:#4facfe,stroke:#00f2fe,stroke-width:2px,color:#fff
                            style D fill:#